slice an array without knowing its dimensions